<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <%- include("./component/header.html"); %>
    <style>
        .main {
            width: 80vw !important;
            max-width: initial !important;
        }

        #result-table {
            width: 100%;
            margin-top: 30px;
            line-height: 2.3em;
        }

        tr {
            white-space: nowrap;
        }

        tr:hover {
            background-color: #f5f5f5;
        }

        tr a {
            cursor: pointer;
        }
    </style>
</head>
<body>
    <%- include("./component/navbar.html"); %>
    <div class="main">
        <h1><%= headText %></h1>
        <%- include("./component/searchbox.html"); %>
        <div id="container">
            <table id="result-table"></table>
            <!-- <table id="origin-table"></table> -->
        </div>
    </div>
    <%- include("./component/footer.html"); %>

    <!-- 获取参数 -->
    <script src="/assets/javascripts/getParams.js"></script>
    <!-- 渲染表格 -->
    <script src="/assets/javascripts/renderTable.js"></script>
    <!-- 搜索书籍 -->
    <script src="/assets/javascripts/searchBooks.js"></script>
    <script>
        var requestParams = getParams();
        var searchbox = document.getElementById("searchInput");
        var keyword = (requestParams["keyword"] || "").trim();
        searchbox.value = keyword;
        if (keyword === "")
            searchbox.focus();

        function doSearch(keyword) {
            search({
                tableElementId: "result-table",
                searchText: keyword,
                categoryId: null
            });
        }
        doSearch(keyword);
    </script>
</body>
</html>